package rexsee.core.menu;

import rexsee.core.style.StyleSheet;
import android.content.Context;

public class PopMenuItem {

	public final String id;
	public Runnable downRunnable = null;
	public Runnable upRunnable = null;

	public final StyleSheet styleNormal;
	public final StyleSheet stylePressed;
	public final StyleSheet styleSelected;

	public PopMenuItem(Context context, String itemId, Runnable itemUpRunnable, String style) {
		this(context, itemId, null, itemUpRunnable, style, style, style);
	}
	public PopMenuItem(Context context, String itemId, Runnable itemUpRunnable, String normalStyle, String pressedStyle, String selectedStyle) {
		this(context, itemId, null, itemUpRunnable, normalStyle, pressedStyle, selectedStyle);
	}
	public PopMenuItem(Context context, String itemId, Runnable itemDownRunnable, Runnable itemUpRunnable, String normalStyle, String pressedStyle, String selectedStyle) {
		id = itemId;
		styleNormal = (new StyleSheet(context)).parseStyle(normalStyle);
		stylePressed = styleNormal.clone().parseStyle(pressedStyle);
		styleSelected = styleNormal.clone().parseStyle(selectedStyle);
		downRunnable = itemDownRunnable;
		upRunnable = itemUpRunnable;
	}

	public void destroy() {
		styleNormal.destroy();
		stylePressed.destroy();
		styleSelected.destroy();
	}

}
